/**  
 * project name  
 * freecomm.fileexplorer  
 * SynchronousAlertDialog.java   
 * 2012-4-27 14:14:14    
 *   
 */
package freecomm.fileexplorer;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;

/**
 * SynchronousAlertDialog
 * 
 * @author: Junwei.Xu
 */
public class SynchronousAlertDialog extends Activity implements DialogInterface.OnClickListener
{
    private Button insteadButton;
    private Button skipButton;
    private Button cancelButton;
    private Intent intent;
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.instead_alert_dialog);
        insteadButton = (Button) findViewById(R.id.inteadButton);
        skipButton = (Button) findViewById(R.id.skipButton);
        cancelButton = (Button) findViewById(R.id.cancelButton);
        
        insteadButton.setOnClickListener(new OnClickListener()
        {

            @Override
            public void onClick(View v)
            {
                intent.putExtra("type", 0);
                SynchronousAlertDialog.this.setResult(1, intent);
                SynchronousAlertDialog.this.finish();
            }
        });
        skipButton.setOnClickListener(new OnClickListener()
        {
            
            @Override
            public void onClick(View v)
            {
                intent.putExtra("type", 1);
                SynchronousAlertDialog.this.setResult(1, intent);
                SynchronousAlertDialog.this.finish();
            }
        });
        cancelButton.setOnClickListener(new OnClickListener()
        {
            
            @Override
            public void onClick(View v)
            {
                intent.putExtra("type",2);
                SynchronousAlertDialog.this.setResult(1, intent);
                SynchronousAlertDialog.this.finish();
            }
        });
    }
    /* (non-Javadoc)  
     * @see android.content.DialogInterface.OnClickListener#onClick(android.content.DialogInterface, int)  
     */
    @Override
    public void onClick(DialogInterface dialog, int which)
    {
        // TODO Auto-generated method stub
        
    }
}
